import requests
from constant import REMOTE,WX_API_KEY,REPORT


def send_msg(msg):
    '''企业微信机器人通知

    :param str msg: _description_
    '''
    headers = {"Content-Type": "text/plain"}

    s = {
        'report': f'报告查看->{REPORT}/job/allure-report/allure/',
        'check': f'执行过程->{REMOTE}/vnc.html',
    }
    data = {
        "msgtype": "text",
        "text": {
            "content": s[msg],
        }
    }
    r = requests.post(url='https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key={}'.format(WX_API_KEY), headers=headers, json=data)
    print(r.text)